<template>
	<view class="announcement">
		<view class="header">
			
		</view>
		<view class="announcent-item" v-for="item in dataList" :key="item.id" @click="gotoannouncementDetail(item.id)">
			<image class="announcement-item-img" :src="item.image"></image>
			<view class="announcement-item-content">
		 	{{item.content}}
			</view>
		</view>
		<view class="footer">
			<image class="footerimg" src="https://wlsy.nanjingyunpeng.cn/weixin/image/footerImg.png"></image>
		</view>
	</view>
</template>

<script>
	import {
		getnotices,
	} from "../../api/api.js"
	export default {
		data() {
			return {
				dataList: []
			}
		},
		onLoad() {
			this.getnotices()
		},
		methods: {
			//系统公告
			async getnotices() {
				let res = await getnotices()
				// console.log(res)
				if (res.code == 1000) {
					// console.log("系统公告",res)
			        res.data.forEach((item,index)=>{
						this.dataList.push({
							id:item.id,
							image:item.image,
							is_show:item.is_show,
							title:item.title,
							content:item.content.substring(3).substring(0,item.content.length-7),
							
						})
					})
				}
			},
			gotoannouncementDetail(val) {
				// console.log("ied",val)
				uni.navigateTo({
					url: `/pages/detail/announcementDetail?id=${val}`
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.announcement {
		min-width: 100%;
		min-height: 100%;
		background-color: #EEF7FE;
		padding: 30rpx;
		padding-top: 70rpx;
		box-sizing: border-box;
		.header{
			width: 750rpx;
			height: 40rpx;
			background:#466EE7 ;
			border-radius: 0rpx 0rpx 60rpx 60rpx;
			position: fixed;
			top: 0;
			left: 0;
		}
		.announcement-item-content{
			padding-left: 10rpx;
			box-sizing: border-box;
		}

		.announcent-item {
			width: 690rpx;
			height: 418rpx;
			background-color: #FFFFFF;
			margin-bottom: 20rpx;
			z-index: 999;
			border-radius: 20rpx 20rpx 20rpx 20rpx;

			.announcement-item-img {
				width: 690rpx;
				height: 280rpx;
				border-radius: 20rpx 20rpx 0rpx 0rpx;
			}

		}
		.footer {
			width: 750rpx;
			height: 324rpx;
			position: fixed;
			bottom: 0;
			left: 0;
		
			.footerimg {
				width: 100%;
				height: 100%;
			}
		}
	}
</style>
